/*
 * Created by Christopher King
 * Copyright (C) 2007 Christopher King, All Rights Reserved.
 */
package us.cirion.adventure.engine;

import java.util.Enumeration;

/**
 * CurrentPlayerLocation provides a generic representation of wherever the player
 * happens to be.  It can be used in script actions that execute regardless
 * of where the player is currently located.
 * @author Chris
 */
public class CurrentPlayerLocation extends ItemLocation
{
	private Player player;

	/**
	 * Constructs a new instance of CurrentPlayerLocation.
	 * @param player The player whose location will be retrieved.
	 */
	public CurrentPlayerLocation(Player player)
	{
		this.player = player;
	}

	/**
	 * Place the provided item at the player's current location.
	 * @param item The item to be moved.
	 */
	public void addItem(Noun item)
	{
		player.getCurrentLocation().addItem(item);
	}

	/**
	 * Retrieve all items at the player's present location.  This only includes
	 * items within the room, and does not include items being carried by the player.
	 * @return All the items in the player's current room.
	 */
	public Enumeration getItems()
	{
		return player.getCurrentLocation().getItems();
	}

	/**
	 * Remove an item from the player's current location.
	 * @param item The item to be removed.
	 */
	public void removeItem(Noun item)
	{
		player.getCurrentLocation().removeItem(item);
	}

	/**
	 * Indicates whether the provided item is in the same room as the player.
	 * @param item The item to be examined.
	 * @return <code>true</code> if the item is present, <code>false</code> otherwise.
	 */
	public boolean containsItem(Noun item)
	{
		return player.getCurrentLocation().containsItem(item);
	}

}
